<?php
/**
 *	同步人员信息
 */
class Cli_TbinformationController extends Ctrl_Cli{
	public function indexAction(){
		while(true){
			$tTime = time();
			$tRunlogdir = APPLICATION_PATH . '/shell/runlog/cli_tbinformation.run';
			Tool_Fnc::writefile($tRunlogdir , $tTime);
			$this->opt();
			sleep(5);
		}
		exit;
	}
	private function opt(){
		$tHCTIMO = new Huadao_Core_T_InsuredModel;
		$tCHIMO = new Case_Huadao_InformationModel;
		$tHCTIDatas = $tHCTIMO->field('ID id')->order('ID desc')->fList();
		
		foreach($tHCTIDatas as $k=>$v){
			$tRow = $tCHIMO->field('id')->where('hcti_id = '.$v['id'])->fRow();
			if(empty($tRow['id'])){
				$tData = array(
					'created' => time(),
					'hcti_id' => $v['id'],
					'status' => 0,
					'fee' => 500,
				);
				if(!$tCHIMO->insert($tData)){
					Tool_Fnc::ajaxMsg('操作失败',001);
				}
			}
		}
		Tool_Fnc::ajaxMsg('操作成功',1);
	}
}
?>
